package com.bitongchong.nowcode;

import java.util.*;

public class Person {
	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner input = new Scanner(System.in);
		int CPUno = input.nextInt();// CPU
		int Memno = input.nextInt();// 内存条
		int mabono = input.nextInt();// 主板
		int Grapno = input.nextInt();// 显卡
		Map<String, Integer> CPU = new HashMap<String, Integer>();
		Map<String, Integer> Mem = new HashMap<String, Integer>();
		Map<String, Integer> mabo = new HashMap<String, Integer>();
		Map<String, Integer> Grap = new HashMap<String, Integer>();
		for (int i = 0; i < CPUno; i++) {
			String name = input.next();
			String version = input.next();
			String rate = input.next();
			int price = input.nextInt();
			CPU.put(name + "-" + version + "-" + rate, price);
		}
		for (int i = 0; i < Memno; i++) {
			String name = input.next();
			String version = input.next();
			String capacity = input.next();
			int price = input.nextInt();
			Mem.put(name + "-" + version + "-" + capacity, price);
		}
		for (int i = 0; i < mabono; i++) {
			String name = input.next();
			String version = input.next();
			int price = input.nextInt();
			mabo.put(name + "-" + version, price);
		}
		for (int i = 0; i < Grapno; i++) {
			String name = input.next();
			String version = input.next();
			String capacity = input.next();
			int price = input.nextInt();
			Grap.put(name + "-" + version + "-" + capacity, price);
		}
		int pricedown = input.nextInt();
		int priceup = input.nextInt();
		Map<String, Integer> fitcom = new HashMap<String, Integer>();
		for (String a : CPU.keySet()) {
			for (String b : Mem.keySet()) {
				for (String c : mabo.keySet()) {
					for (String d : Grap.keySet()) {
						if (CPU.get(a) + Mem.get(b) + mabo.get(c) + Grap.get(d) >= pricedown
								&& CPU.get(a) + Mem.get(b) + mabo.get(c) + Grap.get(d) <= priceup) {
							fitcom.put(a + " " + b + " " + c + " " + d,
									CPU.get(a) + Mem.get(b) + mabo.get(c) + Grap.get(d));
						}
					}
				}
			}
		}
		if (fitcom.isEmpty()) {
			System.out.println("No Computer");
			System.exit(0);
		}
		List<Map.Entry<String, Integer>> list = new ArrayList<>();
		for (Map.Entry<String, Integer> entry : fitcom.entrySet())
			list.add(entry);
		list.sort(new Comparator<Map.Entry<String, Integer>>() {
			@Override
			public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {
				if (o1.getValue().compareTo(o2.getValue())!=0) {
					return o1.getValue() - o2.getValue();
				} else {
					String[] split1 = o1.getKey().split(" ");
					String[] split2 = o2.getKey().split(" ");
					if (split1[0].equals(split2[0])) {
						if (split1[1].equals(split2[1])) {
							if (split1[2].equals(split2[2])) {
								return split1[3].compareTo(split2[3]);
							}
							return split1[2].compareTo(split2[2]);
						}
						return split1[1].compareTo(split2[1]);
					}
					return split1[0].compareTo(split2[0]);
				}
			}
		});
		for (int No = 1; No <= list.size(); No++) {
			System.out.println(No + " " + list.get(No - 1).getKey() + " " + list.get(No - 1).getValue());
		}
	}
}
